home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Sun Solutions 2000 #2
/
Sun Solutions CD (Volume 2 2000)(Special Focus - Java Technologies)(Disc 1).ISO
/
products
/
Software
/
BostonBusinessComputing
/
bbc
/
dist
/
tssunxfltr
< prev
next >
Wrap
Text File
|
2000-02-11
|
2KB
|
72 lines
sed -e 's/\/\(.*\)\/\([^\/]*\)$/\[\1\]\2/' \
-e 's/^\/\(.*\)/\[000000]\1/' \
-e 's/\//\./g' |
awk 'BEGIN { ORS=" "
maxcol = '`getcol - `'
colsize = 20
d = int(maxcol)/int(colsize)
fcount = 0
dcount = 0
tfcount = 0
}
{fname = 1} # Filename is first field
/^$/ { break }
/^Directory/ {
if (dcount != 0 ) {
if ( fcount == 1 )
printf "\n\nTotal of %d file.\n", fcount
else if ( fcount >= 1 )
printf "\n\nTotal of %d files.\n", fcount, dcount
}
dcount = dcount + 1
tfcount = tfcount + fcount
fcount = 0
colnum = 0
printf "\n%s\n\n", $0
continue
}
/^[0-9][0-9]* file[s]* in [0-9][0-9]* dir/{ continue }
$2 ~ /^d/ { $fname = $fname ".dir" }
$2 ~ /^l/ { # Any sym. links?
for ( count=1; count <= NF; count++)
if ($count == "->")
{
fname = count - 1 # Filespec. precedes sym. link
break
}
}
{ n = split($fname, fspec, "/")
if ( fspec[n] !~ '/[\.]/' )
fspec[n] = fspec[n] "."
fcount = fcount + 1
if ( int(colnum) > int(d))
{
printf "\n"
colnum = 1
}
takes = length(fspec[n])/colsize + 1
if ( int(takes) + int(colnum) > int(d))
{
printf "\n"
colnum = takes
}
else
colnum+= int(takes)
fmt = "%-" int(takes) * int(colsize) "s"
printf fmt, fspec[n] } # Print filename
END {
if (fcount == 0 && tfcount == 0)
printf "%%DIRECTORY-W-NOFILES, no files found. \n"
else { tfcount = tfcount + fcount
if ( fcount == 1 )
printf "\n\nTotal of %d file.\n", fcount
else if ( fcount >= 1 )
printf "\n\nTotal of %d files\n", fcount, dcount
if (dcount > 1)
if (tfcount > 1)
printf "\nGrand total of %d directories, %d files.\n", dcount,tfcount
else
printf "\nGrand total of %d directories, %d file.\n", dcount,tfcount
}
}'